package org.cfg;

import com.sojoys.artifact.build.data.base.BaseCfg;
import java.util.List;
import com.sojoys.artifact.tools.ToolMap;
import com.sojoys.artifact.tools.ToolCopy;
import com.sojoys.artifact.factory.bytebuff.IByteBuff;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.sojoys.artifact.constant.DataModelKeyEnum;
/**
 * 天使技能树
 */
public class AngelSkillTreeCfg extends BaseCfg<AngelSkillTreeCfg> {

	/**
	 * 数据库表名称
	 */
	public static final String TABLE_NAME = "angel_skill_tree";
	/**
	 * 完整类名称
	 */
	public static final String CLASS_NAME = "org.cfg.AngelSkillTreeCfg"; 
	/**
	 * 字段个数
	 */
	public static final int COLUMN_COUNT= 9;
	/**
	 * 数据库源字段注释
	 */
	public static final String[] SOURCE_COLUMN_REMARKS = new String[]{"","所属种类","所属英雄ID","位置编号","等级","需要技能点数","前置技能树条件","需要英雄等级","需要天使等级",};
	/**
	 * 数据库源字段名字
	 */
	public static final String[] SOURCE_COLUMN_NAMES = new String[]{"id","skillType","heroId","pos","lvl","needSkillPiont","frontCondition","needHeroLvl","needAngelLvl",};
	/**
	 * 拼音字段名字
	 */
	public static final String[] PINGYING_COLUMN_NAMES = new String[]{"id","skillType","heroId","pos","lvl","needSkillPiont","frontCondition","needHeroLvl","needAngelLvl",};
	/**
	 * HashCode字段名字
	 */
	public static final Integer[] HASHCODE_COLUMN_NAMES = new Integer[]{3355,1991195947,-1220754763,111188,107554,791995201,2053475570,29883474,685973271,};
	/**
	 * 字段基本类型
	 */
	public static final String[] COLUMN_BASICTYPES = new String[]{"int","int","int","int","int","int","List","int","int",};
	/**
	 * 字段引用类型
	 */
	public static final Class[] COLUMN_CLASSTYPES = new Class[]{Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,List.class,Integer.class,Integer.class,};
	
	/**
	 * id
	 */
	private int id;
	
	/**
	 * 所属种类
	 */
	private int skillType;
	
	/**
	 * 所属英雄ID
	 */
	private int heroId;
	
	/**
	 * 位置编号
	 */
	private int pos;
	
	/**
	 * 等级
	 */
	private int lvl;
	
	/**
	 * 需要技能点数
	 */
	private int needSkillPiont;
	
	/**
	 * 前置技能树条件
	 */
	private List frontCondition;
	
	/**
	 * 需要英雄等级
	 */
	private int needHeroLvl;
	
	/**
	 * 需要天使等级
	 */
	private int needAngelLvl;
	
	
	
	public static AngelSkillTreeCfg builder() {
		AngelSkillTreeCfg angelSkillTreeCfg = new AngelSkillTreeCfg();
		return angelSkillTreeCfg;
	}
	
	/**
	 * id
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * 所属种类
	 */
	public int getSkillType() {
		return skillType;
	}
	
	/**
	 * 所属英雄ID
	 */
	public int getHeroId() {
		return heroId;
	}
	
	/**
	 * 位置编号
	 */
	public int getPos() {
		return pos;
	}
	
	/**
	 * 等级
	 */
	public int getLvl() {
		return lvl;
	}
	
	/**
	 * 需要技能点数
	 */
	public int getNeedSkillPiont() {
		return needSkillPiont;
	}
	
	/**
	 * 前置技能树条件
	 */
	public List getFrontCondition() {
		return frontCondition;
	}
	
	/**
	 * 需要英雄等级
	 */
	public int getNeedHeroLvl() {
		return needHeroLvl;
	}
	
	/**
	 * 需要天使等级
	 */
	public int getNeedAngelLvl() {
		return needAngelLvl;
	}
	
	
	protected Object[] getColumnNames(DataModelKeyEnum e){
		switch (e) {
		case SOURCE:
			return SOURCE_COLUMN_NAMES;
		case PINGYING:
			return PINGYING_COLUMN_NAMES;
		case HASHCODE:
			return HASHCODE_COLUMN_NAMES;
		case REMARKS:
			return SOURCE_COLUMN_REMARKS;
		default:
			return PINGYING_COLUMN_NAMES;
		}
	}
	
	protected String[] getBasicTypes(){
		return COLUMN_BASICTYPES;
	}
	
	protected Class[] getClassTypes(){
		return COLUMN_CLASSTYPES;
	}
	
	protected Object[] getColumeValues(){
		Object[] values = new Object[COLUMN_COUNT];
        values[0] = this.id;
        values[1] = this.skillType;
        values[2] = this.heroId;
        values[3] = this.pos;
        values[4] = this.lvl;
        values[5] = this.needSkillPiont;
        values[6] = this.frontCondition;
        values[7] = this.needHeroLvl;
        values[8] = this.needAngelLvl;
        return values;
	}
	
	protected AngelSkillTreeCfg createColumeValues(Object[] vals) {
		this.id = (int)vals[0];
		this.skillType = (int)vals[1];
		this.heroId = (int)vals[2];
		this.pos = (int)vals[3];
		this.lvl = (int)vals[4];
		this.needSkillPiont = (int)vals[5];
		this.frontCondition = (List)vals[6];
		this.needHeroLvl = (int)vals[7];
		this.needAngelLvl = (int)vals[8];
		return this;
	}
	
	protected Map<Object, Object> toMap(Object[] keys,Map<Object, Object> map){
        map.put(keys[0], this.id);
        map.put(keys[1], this.skillType);
        map.put(keys[2], this.heroId);
        map.put(keys[3], this.pos);
        map.put(keys[4], this.lvl);
        map.put(keys[5], this.needSkillPiont);
        map.put(keys[6], this.frontCondition);
        map.put(keys[7], this.needHeroLvl);
        map.put(keys[8], this.needAngelLvl);
        return map;
    }
    
    protected AngelSkillTreeCfg createForMap(Object[] keys,Map map){
   		this.id = (int)map.get(keys[0]);
   		this.skillType = (int)map.get(keys[1]);
   		this.heroId = (int)map.get(keys[2]);
   		this.pos = (int)map.get(keys[3]);
   		this.lvl = (int)map.get(keys[4]);
   		this.needSkillPiont = (int)map.get(keys[5]);
   		this.frontCondition = (List)map.get(keys[6]);
   		this.needHeroLvl = (int)map.get(keys[7]);
   		this.needAngelLvl = (int)map.get(keys[8]);
        return this;
    }
	
	
	protected JSONObject toJSONObject(Object[] keys,JSONObject obj){
        obj.put(keys[0], this.id);
        obj.put(keys[1], this.skillType);
        obj.put(keys[2], this.heroId);
        obj.put(keys[3], this.pos);
        obj.put(keys[4], this.lvl);
        obj.put(keys[5], this.needSkillPiont);
        obj.put(keys[6], this.frontCondition);
        obj.put(keys[7], this.needHeroLvl);
        obj.put(keys[8], this.needAngelLvl);
        return obj;
    }
    
    protected AngelSkillTreeCfg createForJSONObject(Object[] keys,JSONObject obj){
	    this.id = obj.getIntValue(keys[0]);
	    this.skillType = obj.getIntValue(keys[1]);
	    this.heroId = obj.getIntValue(keys[2]);
	    this.pos = obj.getIntValue(keys[3]);
	    this.lvl = obj.getIntValue(keys[4]);
	    this.needSkillPiont = obj.getIntValue(keys[5]);
		this.frontCondition = obj.getObject(keys[6],List.class);
	    this.needHeroLvl = obj.getIntValue(keys[7]);
	    this.needAngelLvl = obj.getIntValue(keys[8]);
        return this;
    }
    
    protected void writeBytes(IByteBuff byteBuf){
	    byteBuf.writeInt(this.id);
	    byteBuf.writeInt(this.skillType);
	    byteBuf.writeInt(this.heroId);
	    byteBuf.writeInt(this.pos);
	    byteBuf.writeInt(this.lvl);
	    byteBuf.writeInt(this.needSkillPiont);
	    byteBuf.writeObject(this.frontCondition);
	    byteBuf.writeInt(this.needHeroLvl);
	    byteBuf.writeInt(this.needAngelLvl);
    }
	
	protected AngelSkillTreeCfg readBytes(IByteBuff byteBuf){
	    this.id = byteBuf.readInt(null);
	    this.skillType = byteBuf.readInt(null);
	    this.heroId = byteBuf.readInt(null);
	    this.pos = byteBuf.readInt(null);
	    this.lvl = byteBuf.readInt(null);
	    this.needSkillPiont = byteBuf.readInt(null);
	    this.frontCondition = (List)byteBuf.readObject();
	    this.needHeroLvl = byteBuf.readInt(null);
	    this.needAngelLvl = byteBuf.readInt(null);
	    return this;
	}
	
	public AngelSkillTreeCfg deepCopy(){
		AngelSkillTreeCfg angelSkillTreeCfg = null;
		try {
			angelSkillTreeCfg = (AngelSkillTreeCfg) super.clone();
		    angelSkillTreeCfg.frontCondition = ToolCopy.copyObject(this.frontCondition);
			return angelSkillTreeCfg;
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return angelSkillTreeCfg;
	}
//自定义内容起始位置
	/**
	 * 总占用技能点
	 */
	private int sumOccupiedSkillPiont;

	public int getSumOccupiedSkillPiont() {
		return sumOccupiedSkillPiont;
	}

	public void setSumOccupiedSkillPiont(int sumOccupiedSkillPiont) {
		this.sumOccupiedSkillPiont = sumOccupiedSkillPiont;
	}
	
//自定义内容结束位置
}
